#include <iostream>
using std::cout;
using std::endl;

class Point
{
public:
    Point(int x = 0,int y = 0)
    : _ix(x)
    , _iy(y)
    {
        cout << "Point(int,int)" << endl;
    }

    ~Point(){
        cout << "~Point()" << endl;
    }

    void print() const{
        cout << "(" << _ix
            << "," << _iy
            << ")" << endl;
    }
protected:
    int _ix;
private:
    int _iy;
};

class Point3D
: public Point//公有继承
{
public:
    Point3D(int x,int y,int z)
    : Point(x,y)//显式调用了Point的构造函数
    , _iz(z)
    {
        cout << "Point3D(int*3)" << endl;
    }

    ~Point3D(){
        cout << "~Point3D()" << endl;
    }

    void display() const{//添加新的成员函数
        print();//基类的公有成员
        cout << _ix << endl;
        /* cout << _iy << endl; */
        cout << _iz << endl;
    }
private:
    int _iz;//添加新的数据成员
};

void test0(){
    Point3D pt3d1(5,8,4);
    pt3d1.print();
    /* pt3d1._ix; */
    /* pt3d1._iy; */
}

int main(void){
    test0();
    return 0;
}
